@isTest
private class UpsertAccountRESTTest {
	static testMethod void testMethod1() {
		TestUtils.createUsers();
    	User appMan = [SELECT Id,Name FROM User WHERE Name='用户1' LIMIT 1];
		
		///创建联系人
		Contact con = TestUtils.createContact();
		con.MobilePhone = '13588885555';
		con.Post__c = '科长/主任';
		con.LastName = '张三';
		insert con;
		///创建联系人
		Contact con1 = TestUtils.createContact();
		con1.MobilePhone = '13588889999';
		con1.Post__c = '主任助理';
		con1.LastName = '李四';
		insert con1;
		//创建客户
		Account acc = TestUtils.createAccount();
		acc.Name = '四川省迈克实业有限公司';
		acc.AccountNumber = 'AN.0001';
		insert acc;
		//创建客户
		Account acc1 = TestUtils.createAccount();
		acc1.Name = '成都市第一人民医院';
		acc1.AccountNumber = 'AN.0002';
		insert acc1;
		
		Test.startTest();
		//测试
		List<UpsertAccountREST.AccountRestArgs> args = new List<UpsertAccountREST.AccountRestArgs>();
		UpsertAccountREST.upsertAccount(args);
		
		UpsertAccountREST.AccountRestArgs arg1 = new UpsertAccountREST.AccountRestArgs();
		arg1.custcode = 'AN.0001';
		arg1.custname = '四川省迈克实业有限公司';
		arg1.areaclcode = '0010';
		arg1.areaclname = '四川成都';
		arg1.conaddr = '四川成都市领事馆路12号';
		arg1.zipcode = '452000';
		arg1.phone1 = '48625452';
		arg1.fax1 = '48625352';
		arg1.linkman1 = '王五';
		arg1.mobilephone1 = '13822223333';
		arg1.email = 'test@163.com';
		arg1.url = 'http://www.163.com';
		arg1.legalbody = '赵六刀';
		arg1.taxpayerid = '川.NO.9874332';
		arg1.zdtype = '0';
		arg1.isgn = 'Y';
		arg1.addrname = '四川成都市领事馆路12号';
		arg1.addrphone = '42353413';
		arg1.addrlinkman = '联系人1';
		arg1.banktypename = '国行';
		arg1.accname = '中国建设银行';
		arg1.account = '622500980098123';
		arg1.accountname = '吴有人';
		arg1.currtypename = 'RMB';
		arg1.ts = '2017-01-01 00:00:00';
        arg1.pk_cubasdoc = 'a000001';

		args.add(arg1);
		
		UpsertAccountREST.AccountRestArgs arg2 = new UpsertAccountREST.AccountRestArgs();
		arg2.custcode = 'AN.0002';
		arg2.custname = '成都市第一人民医院';
		arg2.areaclcode = '0010';
		arg2.areaclname = '四川成都';
		arg2.conaddr = '四川成都市领事馆路18号';
		arg2.zipcode = '452000';
		arg2.phone1 = '48625452';
		arg2.fax1 = '48625352';
		arg2.linkman1 = '张三';
		arg2.mobilephone1 = '13822223333';
		arg2.email = 'test2@163.com';
		arg2.url = 'http://www.265.com';
		arg2.legalbody = '赵六刀';
		arg2.taxpayerid = '川.NO.9874332';
		arg2.zdtype = '1';
		arg2.isgn = 'Y';
		arg2.addrname = '四川成都市领事馆路18号';
		arg2.addrphone = '42353432';
		arg2.addrlinkman = '联系人2';
		arg2.banktypename = '国行';
		arg2.accname = '中国建设银行';
		arg2.account = '622500980098123';
		arg2.accountname = '吴有人';
		arg2.currtypename = 'RMB';
		arg2.ts = '2017-01-01 07:03:01';
        arg2.pk_cubasdoc = 'a000002';
		args.add(arg2);
		
		UpsertAccountREST.upsertAccount(args);
		
		UpsertAccountREST.AccountRestArgs arg3 = new UpsertAccountREST.AccountRestArgs();
		arg3.custcode = 'AN.0003';
		arg3.custname = '印度德里华西儿童医院';
		arg3.areaclcode = '2010';
		arg3.areaclname = '印度';
		arg3.conaddr = '印度德里';
		arg3.zipcode = '452000';
		arg3.phone1 = '48625452';
		arg3.fax1 = '48625352';
		arg3.linkman1 = '王五';
		arg3.mobilephone1 = '13822223333';
		arg3.email = 'test2@163.com';
		arg3.url = 'http://www.265.com';
		arg3.legalbody = '赵六刀';
		arg3.taxpayerid = '川.NO.9874332';
		arg3.zdtype = '0';
		arg3.isgn = 'N';
		arg3.addrname = '四川成都市领事馆路77号';
		arg3.addrphone = '42353432';
		arg3.addrlinkman = '联系人3';
		arg3.banktypename = '国行';
		arg3.accname = '中国建设银行';
		arg3.account = '622500980098123';
		arg3.accountname = '吴有人';
		arg3.currtypename = 'RMB';
		arg3.ts = '2017-01-01 08:03:01';
        arg3.pk_cubasdoc = 'a000003';
		args.add(arg3);
		
		UpsertAccountREST.AccountRestArgs arg4 = new UpsertAccountREST.AccountRestArgs();
		arg4.custcode = 'AN.0005';
		arg4.custname = 'aaaaa bbbbb nnnnn mmmmm kkkkk jjjjj hhhhh llll iiiis iuwuefh wouefowe owefewoiu dfowfi sdjfds lsdjflsdkjfdfd';
		arg4.areaclcode = '2010';
		arg4.areaclname = '印度';
		arg4.conaddr = '印度德里';
		arg4.zipcode = '452000';
		arg4.phone1 = '48625452';
		arg4.fax1 = '48625352';
		arg4.linkman1 = '李四';
		arg4.mobilephone1 = '13822223333';
		arg4.email = 'test2@163.com';
		arg4.url = 'http://www.265.com';
		arg4.legalbody = '赵六刀';
		arg4.taxpayerid = '川.NO.9874332';
		arg4.zdtype = '1';
		arg4.isgn = 'N';
		arg4.addrname = '印度德里';
		arg4.addrphone = '42353432';
		arg4.addrlinkman = '联系人4';
		arg4.banktypename = '国行';
		arg4.accname = '中国建设银行';
		arg4.account = '622500980098123';
		arg4.accountname = '吴有人';
		arg4.currtypename = 'RMB';
		arg4.ts = '2017-01-01 11:22:01';
        arg4.pk_cubasdoc = 'a000004';
		args.add(arg4);

		UpsertAccountREST.upsertAccount(args);
		
		UpsertAccountREST.AccountRestArgs arg5 = new UpsertAccountREST.AccountRestArgs();
		arg5.custcode = 'AN.0004';
		arg5.custname = '印度德里市华西男科医院';
		arg5.areaclcode = '2010';
		arg5.areaclname = '印度';
		arg5.conaddr = '印度德里';
		arg5.zipcode = '452000';
		arg5.phone1 = '48625452';
		arg5.fax1 = '48625352';
		arg5.linkman1 = '李四';
		arg5.mobilephone1 = '13822223333';
		arg5.email = 'test2@163.com';
		arg5.url = 'http://www.265.com';
		arg5.legalbody = '赵六刀';
		arg5.taxpayerid = '川.NO.9874332';
		arg5.zdtype = '1';
		arg5.isgn = 'N';
		arg5.addrname = '印度德里';
		arg5.addrphone = '42353432';
		arg5.addrlinkman = '联系人4';
		arg5.banktypename = '国行';
		arg5.accname = '中国建设银行';
		arg5.account = '622500980098123';
		arg5.accountname = '吴有人';
		arg5.currtypename = 'RMB';
		arg5.ts = '2017-01-01 11:55:01';
		args.add(arg5);
		
		UpsertAccountREST.AccountRestArgs arg6 = new UpsertAccountREST.AccountRestArgs();
		arg6.custcode = 'AN.0006 48625352 dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss dsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdssdsldls lsdkjflsdk sdslkkjdslljsd fdslkfjsdl kldsfjsdlfjsdlk dslfjdslkfj dslsdkfjlds flsdjflkdsjf fdss';
		arg6.custname = '印度德里华西男科医院';
		arg6.areaclcode = '2010';
		arg6.areaclname = '印度';
		arg6.conaddr = '印度德里';
		arg6.zipcode = '452000';
		arg6.phone1 = '48625452';
		arg6.fax1 = '34353434';
		arg6.linkman1 = '李四';
		arg6.mobilephone1 = '13822223333';
		arg6.email = 'test2@163.com';
		arg6.url = 'http://www.265.com';
		arg6.legalbody = '赵六刀';
		arg6.taxpayerid = '川.NO.9874332';
		arg6.zdtype = '1';
		arg6.isgn = 'N';
		arg6.addrname = '印度德里';
		arg6.addrphone = '42353432';
		arg6.addrlinkman = '联系人4';
		arg6.banktypename = '国行';
		arg6.accname = '中国建设银行';
		arg6.account = '622500980098123';
		arg6.accountname = '吴有人';
		arg6.currtypename = 'RMB';
		arg6.ts = '2017-01-01 11:55:01';
		args.add(arg6);
		UpsertAccountREST.upsertAccount(args);
		
		Test.stopTest();
	}
}